<script type="text/javascript" src={'javascript/jquery.flickr-1.0.js'|ezdesign}></script>

<script type="text/javascript">
	
	var random = Math.floor(Math.random()*{$page});
	{literal}
	jQuery(function(){   
			jQuery("#flickrbox").flickr({
				{/literal}
				api_key: "{$apikey}",     
				per_page: {$perpage},
				page: random, 
				type: 'photoset', 
				attr: 'class="thickbox" target="blank"',
				photoset_id: '{$photoset}',
				callback: liteboxCallback
			{literal}	
			}); 
			//alert(random);
	});
	
	function liteboxCallback(el) {
		//tb_init('a.thickbox');
		//jQuery(el).tb_init('a');
		//$(el.li.a).tb_init('a');
		tb_init('a.thickbox');
		imgLoader = new Image();// preload image
		imgLoader.src = tb_pathToImage;
		//alert(el);
	}
	{/literal}
	
	
</script>

<div id="flickrbox">
</div>